package com.zr.inquiry.partner.service.impl;

import com.zr.inquiry.partner.mapper.PartnerMapper;
import com.zr.inquiry.partner.model.pojo.Partner;
import com.zr.inquiry.partner.model.pojo.SearchPartnerPageVo;
import com.zr.inquiry.partner.service.PartnerService;
import com.zr.utils.page.PageUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @ClassName PartnerServiceImpl
 * @Description TODO
 * @Author Jiakui_Ma
 * @Date 2019/11/14 18:30
 */
@Service
public class PartnerServiceImpl implements PartnerService {
    @Autowired
    private PageUtil<SearchPartnerPageVo> page;

    @Autowired
    private PartnerMapper partnerMapper;
    @Override
    public List<Partner> queryPartnerByLegalPersonId(Integer legalPersonId) {
        return partnerMapper.queryPartnerByLegalPersonId(legalPersonId);
    }

    @Override
    public PageUtil<SearchPartnerPageVo> queryPagePartner(SearchPartnerPageVo partnerPageVo) {

        page.setPageIndex(partnerPageVo.getPageIndex());
        page.setTotalNumber(partnerMapper.getCount(partnerPageVo));

        page.setDataList(partnerMapper.queryPagePartner(partnerPageVo));
        return page;
    }
}
